package com.wiscamp.ninechapters.tags.infrastructure.converters;

import com.wiscamp.ninechapters.tags.domain.models.Tag;
import com.wiscamp.ninechapters.tags.infrastructure.po.TagPO;
import com.wiscamp.ninechapters.tags.infrastructure.po.TagView;
import org.mapstruct.Mapper;
import org.mapstruct.MappingTarget;
import org.mapstruct.NullValuePropertyMappingStrategy;
import org.mapstruct.ReportingPolicy;
import org.mapstruct.factory.Mappers;

@Mapper(componentModel = "spring",
        unmappedTargetPolicy = ReportingPolicy.IGNORE,
        unmappedSourcePolicy = ReportingPolicy.IGNORE,
        nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE)
public interface TagConverter {
    TagConverter Instance = Mappers.getMapper(TagConverter.class);

    TagPO toTagPO(Tag Tag);

    TagPO toTagPO(Tag Tag, @MappingTarget TagPO po);

    Tag toTag(TagPO po);

    Tag toTagByView(TagView view);
}
